home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume91
/
news
/
barn_201
/
part01
/
article.h
< prev
next >
Wrap
C/C++ Source or Header
|
1991-02-07
|
2KB
|
79 lines
/*
* File Name: article.h
* Project: BARN - Bah's Amiga ReadNews.
* Purpose: Define structure holding info for each article.
* Author: Jeff Van Epps
* Created: 02 Sep 89
* Last Modified: 06 Jan 91
* Comments:
* History:
* 02 Sep 89/JVE Created.
* 28 Sep 89/JVE Added textpos.
* 18 Oct 90/JVE Added HDR_xxx defines.
* 06 Jan 91/JVE Added subject pointer in article_info as a speed
* optimization.
*/
/*
* Hold header information for an article. Example:
*
* fieldname="From" fieldvalue="foo@bar.com"
* fieldname="Subject" fieldvalue="Care and Eating of Foo Bars"
* etc.
*
*/
typedef struct header_info {
char *fieldname; /* name of field (before :) */
char *fieldvalue; /* text of field (after :) */
struct header_info *next; /* next header in chain */
} HEADER_INFO;
/*
* Information for each article.
*/
typedef struct article_info {
long number; /* article number within newsgroup */
int beenread; /* has article been read? */
long textpos; /* where headers end/text begins */
int done; /* generic temporary marker */
char *subject; /* points at value of Subject hdr */
struct header_info *headers; /* top of header field chain */
struct article_info *next; /* ptr to next article in newsgroup */
} ARTICLE_INFO;
/*
* Defines for common header fields.
*/
# define HDR_FROM "From"
# define HDR_TO "To"
# define HDR_CC "Cc"
# define HDR_SUBJECT "Subject"
# define HDR_SENDER "Sender"
# define HDR_DATE "Date"
/*
* Declare functions.
*/
# ifdef sun
ARTICLE_INFO *ParseArticle();
int GetNextHeader();
void DestroyArticle();
void DumpArticle();
char *GetHeader();
# else
ARTICLE_INFO *ParseArticle( char *filename );
int GetNextHeader( FILE *fp, HEADER_INFO ***hdr );
void DestroyArticle( ARTICLE_INFO *article );
void DumpArticle( ARTICLE_INFO *article );
char *GetHeader( HEADER_INFO *headers, char *name );
# endif